package com.cadre.web.controller.officer;

import com.cadre.common.utils.R;
import com.cadre.common.utils.common.GenerateUUID;
import com.cadre.common.utils.oldutil.ValidatorUtils;
import com.cadre.system.domain.officer.PX_JGXX;
import com.cadre.system.service.DIC_ZBService;
import com.cadre.system.service.PX_JGXXService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

@RequestMapping({"/profess/PX_JGXX"})
@RestController
/* loaded from: PX_JGXXController.class */
public class PX_JGXXController {
    @Resource
    private PX_JGXXService PX_JGXXService;
    @Resource
    private DIC_ZBService dIC_ZBService;

    @GetMapping({"/info/{flowId}"})
    public R info(@PathVariable("flowId") String flowId) {
        return R.ok().put("data", (Object) ((PX_JGXX) this.PX_JGXXService.getById(flowId)));
    }

    @PostMapping({"/save"})
    public R save(@RequestBody PX_JGXX PX_JGXX) {
        PX_JGXX.setJgcode(GenerateUUID.getUUID());
        this.PX_JGXXService.save(PX_JGXX);
        return R.ok();
    }

    @PostMapping({"/update"})
    public R update(@RequestBody PX_JGXX PX_JGXX) {
        ValidatorUtils.validateEntity(PX_JGXX, new Class[0]);
        this.PX_JGXXService.updateById(PX_JGXX);
        return R.ok();
    }

    @PostMapping({"/updateList"})
    public R updateList(@RequestBody List<PX_JGXX> entityList) {
        this.PX_JGXXService.updateBatchById(entityList);
        return R.ok();
    }

    @PostMapping({"/delete"})
    public R delete(@RequestBody String[] flowIds) {
        this.PX_JGXXService.removeBatchByIds(Arrays.asList(flowIds));
        return R.ok();
    }
}
